package com.servicec;

import com.sml.aop.sml.SMLFeignAspect;
import com.sml.aop.sml.SMLLogAspect;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * @Author linlx
 * @Date 2021/8/8 16:06
 * @Description
 **/
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients(basePackages = {"com.servicec"})
public class ServiceCApplication {

  public static void main(String[] args) {
    SpringApplication.run(ServiceCApplication.class, args);
  }

  @Value("${spring.application.name}")
  private String serverName;

  @Value("${logAspect.expireMinutes}")
  private Long expireMinutes;

  @Value("${logAspect.exceptionLogDepth}")
  private Integer exceptionLogDepth;

  @Bean
  public SMLLogAspect logAspect() {
    return new SMLLogAspect(serverName, expireMinutes, exceptionLogDepth);
  }

  @Bean
  public SMLFeignAspect feignAspect() {
    return new SMLFeignAspect(serverName);
  }

}
